require 'net/http'
require 'uri'
require 'flickr'

class ImagesController < ApplicationController    
  def search
    flickr = Flickr.new "a5a8aeb5b7ab008e7da8848f0b96fd54"    
    if (params[:mot_cle])
      @photos = flickr.photos(:tags => params[:mot_cle], :per_page => "100")
    end
  end

  def index
    url = "http://api.flickr.com/services/rest/?method=flickr.interestingness.getList&api_key=a5a8aeb5b7ab008e7da8848f0b96fd54"
    @resp = Net::HTTP.get_response(URI.parse(url))
    @images = Hash.from_xml(@resp.body)    
  end
end